#ifndef CLASS_COMPONENT_COORDINATES_HPP_
# define CLASS_COMPONENT_COORDINATES_HPP_

namespace		Component
{
  template<typename T, int unsigned = 1>
  class			Coordinates
  {
  public:
	Coordinates(T const &a = 0) : x(a) {}

	Coordinates const	&operator=(Coordinates const &c)
	{
	  if (this != &c)
		this->x = c.x;
	  return (*this);
	}

	Coordinates const	&operator+=(Coordinates const &c)
	{
	  if (this != &c)
		this->x += c.x;
	  return (*this);
	}

	virtual ~Coordinates() throw() {}

	T			x;
  };

  template<typename T>
  class			Coordinates<T, 2>: public Coordinates<T, 1>
  {
  public:
	Coordinates(T const &a = 0, T const &b = 0) : Coordinates<T, 1>(a), y(b) {}

	Coordinates const	&operator=(Coordinates const &c)
	{
	  if (this != &c)
		{
		  this->Coordinates<T, 1>::operator=(c);
		  this->y = c.y;
		}
	  return (*this);
	}

	Coordinates const	&operator+=(Coordinates const &c)
	{
	  if (this != &c)
		{
		  this->Coordinates<T, 1>::operator+=(c);
		  this->y += c.y;
		}
	  return (*this);
	}

	virtual ~Coordinates() throw() {}

	T			y;
  };

  template<typename T>
  class			Coordinates<T, 3>: public Coordinates<T, 2>
  {
  public:
	Coordinates(T const &a = 0, T const &b = 0, T const &c = 0) : Coordinates<T, 2>(a, b), z(c) {}

	Coordinates const	&operator=(Coordinates<T, 2> const &c)
	{
	  if (this != &c)
		this->Coordinates<T, 2>::operator=(c);
	  return (*this);
	}
	Coordinates const	&operator=(Coordinates const &c)
	{
	  if (this != &c)
		{
		  this->Coordinates<T, 2>::operator=(c);
		  this->z = c.z;
		}
	  return (*this);
	}

	Coordinates const	&operator+=(Coordinates<T, 2> const &c)
	{
	  if (this != &c)
		this->Coordinates<T, 2>::operator+=(c);
	  return (*this);
	}
	Coordinates const	&operator+=(Coordinates const &c)
	{
	  if (this != &c)
		{
		  this->Coordinates<T, 2>::operator+=(c);
		  this->z += c.z;
		}
	  return (*this);
	}

	virtual ~Coordinates() throw() {}

	T			z;
  };


  typedef Coordinates<int, 1>			Vector1i;
  typedef Coordinates<int unsigned, 1>	Vector1iu;
  typedef Coordinates<float, 1>			Vector1f;

  typedef Coordinates<int, 2>			Vector2i;
  typedef Coordinates<int unsigned, 2>	Vector2iu;
  typedef Coordinates<float, 2>			Vector2f;

  typedef Coordinates<int, 3>			Vector3i;
  typedef Coordinates<int unsigned, 3>	Vector3iu;
  typedef Coordinates<float, 3>			Vector3f;


  typedef Coordinates<float, 1>			Vector1;
  typedef Coordinates<float, 2>			Vector2;
  typedef Coordinates<float, 3>			Vector3;
}

#endif
